/**
 * 
 */
package net.efo.model.sqlite;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * @author johnydoe
 *
 */
public class Statements {

	private Connector connector;
	
	public Statements(String location) throws ClassNotFoundException, SQLException {
		this.connector = Connector.getInstance(location);
	}
	
	public ResultSet query(String query) throws SQLException {
		ResultSet rs = this.connector.getStatement().executeQuery(query);
		return rs;
	}
	
	public void all(String query) throws SQLException {
		
	}
	
	public boolean update(String query) throws SQLException {
		int rs = this.connector.getStatement().executeUpdate(query);
		if (rs == Statement.SUCCESS_NO_INFO) {
			return true;
		} else {
			return false;
		}
	}
	
	public boolean insert(String query) throws SQLException {
		int rs = this.connector.getStatement().executeUpdate(query);
		if (rs == Statement.SUCCESS_NO_INFO) {
			return true;
		} else {
			return false;
		}
	}
	
	public boolean delete(String query) throws SQLException {
		int rs = this.connector.getStatement().executeUpdate(query);
		if (rs == Statement.SUCCESS_NO_INFO) {
			return true;
		} else {
			return false;
		}
	}
}
